﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using MyLiEda.Events.Common;

namespace MyLiEda.Api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class TestEventController : ControllerBase
    {
        private readonly IConfiguration configuration;
        
        private readonly IEventBus eventBus;

        public TestEventController(IConfiguration configuration,IEventBus eventBus)
        {
            this.configuration = configuration;
            this.eventBus = eventBus;
        }
        [HttpGet]
        public async Task<string> GetAsync()
        {
            //add publish event object 
            await eventBus.PublishAsync(new MyLiEvent("doug"));
            return "true";
        }
    }
}